<template>
  <div>

    <a-button @click="testFilter">测试全局过滤器</a-button>
    <br/>
    {{ tokenInfo.token }} <br/>
    <a-button @click="testLogin">模拟登录</a-button>
    <br/>
    <a-button>模拟退出</a-button>
    <br/>

  </div>
</template>

<script>
import {getAction, putAction, postAction, delAction, httpAction} from "@/api/provider/apiProvider";

import {setCookie} from "@/utils/auth";
import {ACCESS_TOKEN} from "@/store/mutations-type";

export default {
  name: "demo",
  data() {
    return {
      tokenInfo: {},
      url: {
        test: "/commonApi/test",
        logout: "/commonApi/doLogout",
        login: "/commonApi/doLogin",
      }
    }
  },
  methods: {
    testFilter() {
      getAction(this.url.test).then(res => {
        console.log(res);
      })
    },
    testLogin() {
      httpAction(this.url.login, {loginId: "1", device: "iOS"}, "post").then(res => {
        if (res.success) {
          this.$message.success(res.message)
          console.log(res.result)
          this.tokenInfo = res.result;
          setCookie(ACCESS_TOKEN, res.result.token);
        } else {
          this.$message.error(res.message)
        }
      });
    },
    testLogout() {

    }
  }
}
</script>

<style scoped>

</style>
